--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_hoshiguma_yugi = General:new(extension, "hy_hoshiguma_yugi", "ten_k", 4, 4, General.Female)
    local strength_kill = fk.CreateSkill {
        name = "strength_kill",
    }
    strength_kill:addEffect("active", {
        anim_type = "offensive",
        min_card_num = 1,
        max_card_num = 3,
        target_num = 0,
        card_filter = function(self, player, to_select, selected)
            return Fk:getCardById(to_select).trueName == "slash" and not player:prohibitDiscard(Fk:getCardById(to_select)) and #selected <= 2
        end,
        target_filter = Util.FalseFunc,
        can_use = function(self, player)
            return #table.filter(player:getCardIds("h"), function(id)
                return Fk:getCardById(id).trueName == "slash" and not player:prohibitDiscard(Fk:getCardById(id))
            end) > 0
        end,
        prompt = "strength_kill_prompt",
        on_use = function(self, room, cardUseEvent)
            local cards = cardUseEvent.cards
            local player = cardUseEvent.from
            local marks = player:getTableMark("@strength_kill")
            table.insertIfNeed(marks, #cards)
            table.sort(marks, function(a, b)
                return a < b
            end)
            room:setPlayerMark(player, "@strength_kill", marks)
            room:throwCard(cards, strength_kill.name, player, player)
        end,
    })
    strength_kill:addEffect(fk.PreCardUse, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and target == player and data.card.trueName == "slash" and #player:getTableMark("@strength_kill") > 0
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            if table.contains(player:getTableMark("@strength_kill"), 1) then
                data.extraUse = true
            end
            if table.contains(player:getTableMark("@strength_kill"), 2) then
                data.disresponsiveList = room:getAlivePlayers()
            end
            if table.contains(player:getTableMark("@strength_kill"), 3) then
                data.additionalDamage = (data.additionalDamage or 0) + 2
            end
            room:setPlayerMark(player, "@strength_kill", 0)
        end,
    })
    strength_kill:addEffect("targetmod", {
        bypass_distances = function(self, player, skill, card, to)
            if card.trueName == "slash" and table.contains(player:getTableMark("@strength_kill"), 2) then
                return true
            end
        end,
        bypass_times = function(self, player, skill, scope, card, to)
            if card.trueName == "slash" and table.contains(player:getTableMark("@strength_kill"), 1) then
                return true
            end
        end
    })
    local violent_tempest = fk.CreateSkill {
        name = "violent_tempest",
    }
    violent_tempest:addEffect(fk.CardUseFinished, {
        anim_type = "defensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(violent_tempest.name) and target ~= player and (player:getLastAlive() == target or player:getLastAlive():getLastAlive() == target) and data.card.trueName == "slash" and
                data.card:getEffectiveId() and
                Fk:currentRoom():getCardOwner(data.card) == nil
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:obtainCard(player, data.card, true, fk.ReasonPrey)
        end,
    })
    violent_tempest:addEffect(fk.EventPhaseProceeding, {
        mute = true,
        is_delay_effect = true,
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(violent_tempest.name) and target == player and target.phase == Player.Discard
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            data.phase_end = true
            local toDiscard = table.filter(player:getCardIds(Player.Hand), function(id)
                local card = Fk:getCardById(id)
                return table.every(room.status_skills[MaxCardsSkill] or Util.DummyTable, function(skill)
                    return not skill:excludeFrom(player, card)
                end)
            end)
            room:broadcastProperty(player, "MaxCards")

            local count = 0
            local discardNum = #toDiscard - player:getMaxCards()
            for _, id in ipairs(toDiscard) do
                if count < 3 and Fk:getCardById(id).trueName == "slash" then
                    discardNum = discardNum - 1
                    count = count + 1
                end
            end

            if discardNum > 0 then
                Fk.currentResponseReason = "phase_discard"
                room:askToUseActiveSkill(player, {
                    skill_name = "violent_tempest_discard",
                    prompt = "#AskForDiscard:::" .. discardNum .. ":" .. discardNum,
                    cancelable = false,
                    extra_data = {
                        num = discardNum,
                        min_num = discardNum,
                        include_equip = false,
                        skillName = "phase_discard",
                        pattern = ".",
                    }
                })
                Fk.currentResponseReason = nil
            end
        end
    })
    local violent_tempest_discard = fk.CreateSkill {
        name = "violent_tempest_discard",
    }
    violent_tempest_discard:addEffect('active', {
        min_card_num = function(self, player) return self.min_num end,
        max_card_num = function(self, player) return self.num end,
        card_filter = function(self, player, to_select, selected)
            if #selected >= self.num then
                return false
            end

            if Fk:currentRoom():getCardArea(to_select) == Card.PlayerSpecial then
                local pile = ""
                for p, t in pairs(player.special_cards) do
                    if table.contains(t, to_select) then
                        pile = p
                        break
                    end
                end
                if not string.find(self.pattern or "", pile) then return false end
            end

            local card = Fk:getCardById(to_select)

            local status_skills = Fk:currentRoom().status_skills[ProhibitSkill] or Util.DummyTable
            for _, skill in ipairs(status_skills) do
                if skill:prohibitDiscard(player, card) then
                    return false
                end
            end
            if Fk.currentResponseReason == "phase_discard" then
                ---@type MaxCardsSkill[]
                status_skills = Fk:currentRoom().status_skills[MaxCardsSkill] or Util.DummyTable
                for _, sk in ipairs(status_skills) do
                    if sk:excludeFrom(player, card) then
                        return false
                    end
                end
            end

            if not self.include_equip and Fk:currentRoom():getCardArea(card) == Player.Equip then
                return false
            end

            if self.pattern and self.pattern ~= "" and not Exppattern:Parse(self.pattern):match(card) then
                return false
            end

            local all_slash = table.filter(player:getCardIds("h"), function(id)
                return Fk:getCardById(id).trueName == "slash"
            end)
            local selected_slash = table.filter(selected, function(id)
                return Fk:getCardById(id).trueName == "slash"
            end)
            if card.trueName == "slash" and #all_slash - #selected_slash <= 3 then
                return false
            end

            return true
        end,
        on_use = function(self, room, skillUseEvent)
            room:throwCard(skillUseEvent.cards, violent_tempest_discard.name, skillUseEvent.from, skillUseEvent.from)
        end,
    })
    extension:loadSkillSkels { strength_kill, violent_tempest, violent_tempest_discard }
    hy_hoshiguma_yugi:addSkill("strength_kill")
    hy_hoshiguma_yugi:addSkill("violent_tempest")
    Fk:loadTranslationTable {
        ["hy_hoshiguma_yugi"] = "星熊勇仪",
        ["#hy_hoshiguma_yugi"] = "以力服人",
        ["illustrator:hy_hoshiguma_yugi"] = "shihou",
        ["designer:hy_hoshiguma_yugi"] = "黑曜人形",
        ["cv:hy_hoshiguma_yugi"] = "",

        ["strength_kill"] = "力杀",
        [":strength_kill"] = "出牌阶段，你可以弃置一至三张【杀】并执行对应序号项：1.你的下一张【杀】不计入次数且无次数限制；2.你的下一张【杀】无距离限制且不可被响应；3.你的下一张【杀】伤害+2（不可叠加）。",
        ["@strength_kill"] = "力杀",
        ["#strength_kill_trigger"] = "力杀",
        ["#strength_kill_targetmod"] = "力杀",
        ["strength_kill_prompt"] = "力杀：你可以弃置1~3张【杀】并强化你的下一张【杀】",

        ["violent_tempest"] = "凶岚",
        ["$violent_tempest"] = "凶岚",
        [":violent_tempest"] = "你的上家和其上家（不能为你）使用的【杀】结算结束后，你获得之。你的至多三张【杀】不计入手牌上限。",

        ["violent_tempest_discard"] = "弃牌阶段",
    }
end
